package nyttHus.model3D;

import context.*;

import nyttHus.NyttHusProsjekt;
import geometry3D.Point3D;

//Java 3D
import javax.media.j3d.Appearance;
import javax.media.j3d.Group;
import javax.media.j3d.Shape3D;
import javax.vecmath.Point3f;
import com.sun.j3d.utils.geometry.GeometryInfo;

import java.util.Vector;


// ***************************************************************************
// *** CLASS: Terreng
// ***************************************************************************
public class Terreng implements Context.Constants,NyttHusProsjekt.Constants
{ //private static final boolean DEBUG=true; // Overriding Context.Constants.DEBUG
  
  private Vector<Trekant> gressTrekanter=new Vector<Trekant>();
  private Vector<Trekant> asfaltTrekanter=new Vector<Trekant>();
  
  // ***************************************************************************
  // *** METHOD: addGressTrekant
  // ***************************************************************************
  public void addGressTrekant(Point3D t0,Point3D t1,Point3D t2)
  { gressTrekanter.addElement(new Trekant(t0,t1,t2)); }
  
  // ***************************************************************************
  // *** METHOD: addAsfaltTrekant
  // ***************************************************************************
  public void addAsfaltTrekant(Point3D t0,Point3D t1,Point3D t2)
  { asfaltTrekanter.addElement(new Trekant(t0,t1,t2)); }
  
  public Terreng()
  { define3DModel(); }


private static double kote[][]={
//          0      1      2      3      4      5      6      7      8      9     10     11     12     13     14     15     16     17     18     19     20     21     22     23     24     25     26     27     28     29     30     31     32     33     34     35     36     37     38     39     40     41     42
/*  0 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  1 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  2 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  3 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  1 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  2 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  3 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  4 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  5 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  6 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  7 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  8 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/*  9 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 10 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,123.50,123.55,123.60,123.65,123.70,123.75,123.80,123.85,123.90,123.95,124.00,124.05,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 11 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 12 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 13 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 14 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 15 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 16 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 17 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 18 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 19 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 20 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 21 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 22 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 23 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 24 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 25 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 26 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 27 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 28 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 29 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 30 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 31 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 32 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 33 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 34 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 35 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 36 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 37 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 38 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 39 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 40 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 41 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 42 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 43 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 44 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 45 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 46 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 47 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 48 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
/* 49 */ {125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,125.00,124.94,124.88,124.82,124.76,124.70,124.64,124.58,124.52,124.46,124.40,124.34,124.28,124.22,124.16,124.10,124.04,123.98,123.92,123.86,123.80,123.74,123.68,123.62,123.56,123.50,123.50},   
    };


private static int color[][]={
//          0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41
/*  0 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/*  1 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/*  2 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  3 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  4 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  5 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  6 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  7 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  8 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/*  9 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/* 10 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/* 11 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2},   
/* 12 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 13 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 14 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 15 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 16 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 17 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 18 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 19 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 20 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 21 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 22 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 23 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 24 */ {  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 25 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 26 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 27 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 28 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 29 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 30 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 31 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 32 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 33 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 34 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 35 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 36 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 37 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 38 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 39 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 40 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 41 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 42 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 43 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 44 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 45 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 46 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 47 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
/* 48 */ {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},   
    };

  private void define3DModel()
  { Point3D p0=NyttHusProsjekt.p0Terreng;
    for(int i=0;i<49;i++)
    { for(int j=0;j<41;j++)
      {
        Point3D t0=p0.addZ(i*0.50).addX(j*1.00).addY(kote[i][j]-125);
        Point3D t1=p0.addZ(i*0.50).addX((j+1)*1.00).addY(kote[i][j+1]-125);
        Point3D t2=p0.addZ((i+1)*0.50).addX((j+1)*1.00).addY(kote[i+1][j+1]-125);
        Point3D t3=p0.addZ((i+1)*0.50).addX(j*1.00).addY(kote[i+1][j]-125);
        int colorCode=color[i][j];
        switch(colorCode)
        {
          case 0: break; // NOT PRESENT
          case 1:
            addGressTrekant(t0,t1,t2);
            addGressTrekant(t0,t2,t3);
            break;
          case 2:
            addAsfaltTrekant(t0,t1,t2);
            addAsfaltTrekant(t0,t2,t3);
            break;
        }
      }      
    }
  }
  
  public void addModel3D(Group model)
  { addTrekanter(model,gressTrekanter,gressAppearance);
    addTrekanter(model,asfaltTrekanter,asfaltAppearance);
  }
  
  public void addTrekanter(Group model,Vector<Trekant> trekanter,Appearance appearance)
  {
    int n=trekanter.size();
    if(n==0) return;
    Point3f[] forside=new Point3f[3*n];
    Point3f[] bakside=new Point3f[3*n];
    for(int i=0;i<n;i++)
    { forside[3*i+0]=bakside[3*i+2]=trekanter.elementAt(i).t0.toPoint3f();
      forside[3*i+1]=bakside[3*i+1]=trekanter.elementAt(i).t1.toPoint3f();
      forside[3*i+2]=bakside[3*i+0]=trekanter.elementAt(i).t2.toPoint3f();
    }
    GeometryInfo geometryInfoForside=new GeometryInfo(GeometryInfo.TRIANGLE_ARRAY);
    geometryInfoForside.setCoordinates(forside);
    Shape3D shape1=new Shape3D(geometryInfoForside.getGeometryArray(),appearance);
    model.addChild(shape1);

    GeometryInfo geometryInfoBakside=new GeometryInfo(GeometryInfo.TRIANGLE_ARRAY);
    geometryInfoBakside.setCoordinates(bakside);
    Shape3D shape2=new Shape3D(geometryInfoBakside.getGeometryArray(),appearance);
    model.addChild(shape2);
  
  }

  // ***************************************************************************
  // *** INNER CLASS: Trekant
  // ***************************************************************************
  class Trekant
  { Point3D t0,t1,t2;
    Trekant(Point3D t0,Point3D t1,Point3D t2)
    { this.t0=t0; this.t1=t1; this.t2=t2; }
  }

}  
